home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3093 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: csd.uwo.ca!jamie
  2. From: jamie@csd.uwo.ca (J. Blustein)
  3. Newsgroups: comp.lang.c
  4. Subject: C or C++ for a 14-year old? The definitive reply
  5. Supersedes: <4e90dl$s6@falcon.ccs.uwo.ca>
  6. Followup-To: comp.lang.c
  7. Date: 25 Jan 1996 22:33:19 GMT
  8. Organization: Computer Science Dept., Univ. of Western Ontario, London, Canada
  9. Message-ID: <4e90ff$u2@falcon.ccs.uwo.ca>
  10. Reply-To: jamie@uwo.ca
  11. NNTP-Posting-Host: gleep.csd.uwo.ca
  12. Summary: There is no inefficiency in hinding data/code with C.  Example below.
  13. Keywords: opaque type abstract data ADT
  14. X-Copyright: copyright (c) J. Blustein, 1996.  All rights reserved 
  15. Disclaimer: It's people like you what cause unrest!
  16. Originator: jamie@csd.uwo.ca
  17.  
  18. In article <4e5t1c$71c@solutions.solon.com>,
  19. Peter Seebach <seebs@solutions.solon.com> wrote:
  20. >In article <4e3mvdINNpi3@mayne.ugrad.cs.ubc.ca>,
  21. >Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
  22. >>Information hiding leads to inefficiencies---and you _can_ have it in C, by the
  23. >>way. Even the C preprocessor lets you have efficient information hiding, if you
  24. >>use it with discipline. It's cheaper to access elements of a function via
  25. >>macros than be forced to communicate via abstract function calls. The only
  26. >>advantage that information hiding gives you is that 1) you can change the
  27. >>implementation of the data structure easily without recompiling modules that
  28. >>use it (big deal). 2) you have more control over how your software gets used. I
  29. /* Following-up to comp.lang.c only.  This post has nothing to do with C++. */
  30.  
  31.     You don't have to resort to using the pre-processor to hide types and
  32. function calls.  If you use opaque types there is no runtime penalty and
  33. you get plenty of hiding.  Think about how FILE * is hidden in the standard
  34. library for example.
  35.     I scribbled some notes about this at
  36. http://www.csd.uwo.ca/~jamie/.Refs/encapsulatedC.html 
  37. .  Feel free to take a look.
  38.  
  39. [...]
  40. >Point 1 is, in fact, a *very* big deal.  The larger the project, the more
  41.     I agree of course.
  42. -- 
  43. Jamie Blustein                                         `Did you say "knives"?'
  44. <jamie@uwo.ca>                                         `*Rotating* knives, yes.'
  45.